Component({
  properties: {
    edit: {
      type: Boolean,
      value: false
    },
    allSelected: {
      type: Boolean,
      value: false
    },
    totalQuantity: 0,
    totalPrice: 0
  },
  data: {},
  methods: {
    changeAllSelected() {
      this.triggerEvent('changeAllSelected')
    },

    toOrder() {
      this.triggerEvent('toOrder')
    },

    deleteCart() {
      wx.showModal({
        title: '您确定要删除选中的商品吗?',
        success: res => {
          if (res.confirm) {
            this.triggerEvent('deleteCart')
          }
        }
      })
    },

    clearCart() {
      wx.showModal({
        title: '您确定要清空购物车吗?',
        success: res => {
          if (res.confirm) {
            this.triggerEvent('clearCart')
          }
        }
      })
    }
  }
});
